package cn.cloudtogo.common.atomapi.token;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * @author yaolianhua789@gmail.com
 **/
@Data
public class ApiToken {

    @JsonProperty("name")
    private String notes;
    private String token;
    private boolean disable;
    private String type;
    private Expiration expiration;

    public static ApiToken of(String notes,
                              String token,
                              String type,
                              Expiration expiration) {
        ApiToken apiToken = new ApiToken();

        apiToken.setToken(token);
        apiToken.setNotes(notes);
        apiToken.setType(type);
        apiToken.setExpiration(expiration);

        return apiToken;
    }

    public static ApiToken of(String token,
                              String type) {
        return of(null, token, type, null);
    }

    public static ApiToken of(String token) {
        return of(token, null);
    }

    public static ApiToken of() {
        return of(null);
    }
}
